Skip to main content

Windows Server 2016 to 2022 In-Place Upgrade

Automated SSM Automation solution for upgrading EC2 instances directly from Windows Server 2016 to Windows Server 2022. Microsoft supports this two-version jump via installation media, so you can skip 2019 entirely.

Note: This is sample code, for non-production usage. You should work with your security and legal teams to meet your organizational security, regulatory and compliance requirements before deployment.

Why Upgrade?​

Windows Server 2016 reaches end of support on January 12, 2027. After that date, Microsoft no longer provides free security patches for Windows Server 2016. Organizations that remain on 2016 must purchase Extended Security Updates (ESU), which carry significant per-instance annual costs.

YearESU Cost (per 2-vCPU core pack)
Year 1 (2027)~75% of the license cost
Year 2 (2028)~100% of the license cost
Year 3 (2029)~125% of the license cost

Upgrading straight to Windows Server 2022 avoids ESU charges entirely and buys the longest support runway of any in-place target: extended support runs through October 14, 2031. Going directly to 2022 (rather than 2019) means one upgrade event instead of two, and a target that stays supported roughly two years longer than 2019.

When to Use This​

The preferred approach for OS upgrades is to build new servers and redeploy your application — see Microsoft's upgrade overview for guidance on upgrade paths.

When rebuilding isn't practical, this automation performs a Windows in-place upgrade directly on the existing EC2 instance, based on the AWS in-place upgrade guide. Common scenarios:

  • Legacy applications with deep OS-level dependencies (registry, COM registrations, local state)
  • Instances with configurations that are difficult to replicate (Active Directory domain-joined, complex network ACLs, custom drivers)
  • Fleets where the cost and risk of rebuilding every server exceeds an in-place upgrade
  • Short timelines where there isn't time to re-architect

What's Included​

FileDescription
Windows-2016-to-2022-Upgrade.jsonMain SSM Automation document — performs the full upgrade (79 steps, 8-cycle verify chain)
windows-2016-to-2022-precheck.jsonPre-flight check document — validates readiness without making changes
windows-2016-to-2022-roles-cfn.jsonCloudFormation template — deploys the two IAM roles + instance profile
IAM RolesIAM role and policy setup instructions
Automation FlowchartVisual diagram of all execution paths

Key Differences from 2016→2019​

  • Targets Windows Server 2022 {lang} Installation Media snapshots
  • Verifies OS build 20348.x (Server 2022)
  • .NET Framework 4.8 is in-box (vs 4.7.2 on 2019)
  • Pinned cumulative updates target Server 2022

Getting Started​

  1. Create the IAM roles required by the automation (CloudFormation)
  2. Deploy the SSM documents directly via aws ssm create-document (not embedded in CloudFormation — see note below)
  3. Run a pre-flight check (DryRun=true) to validate your instance
  4. Start the upgrade (DryRun=false)
Split deployment

The IAM roles deploy via CloudFormation, but the SSM documents are deployed directly with aws ssm create-document. The documents cannot be embedded in CloudFormation: it re-serializes the inline document content, which pushes the upgrade document past the 64 KiB SSM document limit and fails with Invalid request provided: 64 KiB.

👉 Full guide →